<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>


<% 
  
    // 接收用户数据
    request.setCharacterEncoding("utf-8");
    String userid = request.getParameter("userid");
    String name = request.getParameter("name");
    String phone = request.getParameter("phone");
    String roomType = request.getParameter("roomType");
    String indate = request.getParameter("indate");
    String outdate = request.getParameter("outdate");
    String amount = request.getParameter("amount");
    String price = request.getParameter("price");
    String room_number = request.getParameter("room_number");
    String btn = request.getParameter("btn");
    String sql = "";
    //insert
    sql = "insert into 成都梦之旅文君楼庭院酒店（宽窄巷子店）(userid,name,phone,roomType,indate,outdate,amount,price,room_number) values('"+ userid +"','"+ name +"','"+ phone +"','"+ roomType +"','"+ indate +"','"+ outdate +"','"+ amount +"','"+ price +"','"+ room_number +"')";
    
    if("修改".equals(btn)){
       //update
        sql = "update 成都梦之旅文君楼庭院酒店（宽窄巷子店） set name='" + name +"',phone='" + phone +"',roomType='" + roomType +"',indate='" + indate +"',outdate='" + outdate +"',amount='" + amount +"',price='" + price +"',room_number='" + room_number +"' where userid='"+ userid +"'";
    }else if("del".equals(btn)){
    	
    	//delete
        sql = "delete from 成都梦之旅文君楼庭院酒店（宽窄巷子店） where userid='"+ userid + "'";
    }
    	
     
    int ret = aa.db.DBTools.doSql(sql);
    System.out.println("ret=" + ret);
   
    response.sendRedirect("reservationServlet.jsp");
    
    

  %>

</body>
</html>